#ifndef __BUOLA_GUI_EVENTS_H__
#define __BUOLA_GUI_EVENTS_H__

#include <buola/gui.h>
#include <buola/utility/cregion.h>
#include <buola/gui/tkey.h>

namespace buola { namespace gui {

/// \defgroup events window events
/// \ingroup gui
/// These are classes used in window callbacks to pass information about
/// events.
///@{

/// \brief expose event
///

struct CExposeEvent
{
    img::CGC *mGC;           //!< graphic context
    CRegion mRegion;    //!< region which should be updated
    CRect_d mRect;        //!< bounding rectangle of region
};

/// \brief mouse event
///

struct CMouseEvent
{
    //! event types
    enum EType
    {
        PRESS,
        RELEASE,
        MOTION,
        WHEEL,
        MOVEIN,
        MOVEOUT
    };

    CWindow *mTarget;       ///< the target window
    
    EType mType;            ///< mouse event type

    EMouseButton mButton;   ///< mouse button for this event
    EKeyMod mMods;          ///< keyboard modifiers pressed
    EKeyLock mLocks;        ///< keyboard locks active
    EMouseButton mButtons;  ///< mouse buttons pressed
    CPoint_d mPoint;        ///< mouse location
    CPoint_d mRootPoint;    ///< mouse location in root coordinates
    int mClickCount;        ///< number of consecutive clicks (from one to three), or zero for release events
    
    double mScrollX;        ///< for wheel events
    double mScrollY;        ///< for wheel events
    double mScrollZ;        ///< for wheel events
};

/// \brief keyboard event
///

struct CKeyEvent
{
    //! event types
    enum EType
    {
        RELEASE,
        PRESS
    };

    CWindow *mTarget;
    
    EType mType;        //!< key event type

    bool mPlainChar;    //!< (only for PRESS events). If this is true, OnChar will be generated, in addition to OnKeyDown
    wchar_t mChar;      //!< character
    TKey mKey;          //!< key code
    EKeyMod mMods;      //!< keyboard modifiers pressed
    EKeyLock mLocks;    //!< keyboard locks active
};

/// \brief window geometry event
///

struct CGeometryEvent
{
    CPoint_d mPos;
    CSize_d mSize;
};

/// \brief focus event
///

struct CFocusEvent
{
};

/// \brief drag and drop event
///

struct CDNDEvent
{
};

/// \brief child event
///

enum EChildEvent
{
    CHILD_NONE,
    CHILD_CREATE,
    CHILD_DESTROY,
    CHILD_UNMAPPED,
    CHILD_MAPPED,
    CHILD_TITLECHANGED,
    CHILD_ACTIVATED
};

///@}

/*namespace gui*/ } /*namespace buola*/ }

#endif
